package reflect.mainMethod;

import java.lang.reflect.Method;

public class MainReflect {
    public static void main(String[] args) {
        try {
            Class clazz = Class.forName("reflect.mainMethod.Student");
            // 获取main方法
            Method methodMain = clazz.getMethod("main", String[].class);
            // 调用main方法
            methodMain.invoke(null, (Object)new String[]{"a", "b", "c"});
        } catch (Exception e){
            e.printStackTrace();
        }
    }
}
